package com.ai.common.core.pager.model;

import java.io.Serializable;
import java.util.List;

/**
 * @author rbangjie rbangjie@163.com 2012-10-17
 */
public class PagerModel<T> implements Serializable {

	private static final long serialVersionUID = 1L;

	private Integer pageSize = 16;

	private Integer startIndex;

	// 当前页行的结束索引
	private Integer endIndex;

	// 当前页
	private Integer currentPage;

	// 上一页索引
	private Integer priviousPage;

	// 下一页索引
	private Integer nextPage;

	// 记录数
	private Integer count = 0;

	// 总页数
	private Integer pageCount = 0;

	// 数据集合
	private List<T> dataList;

	public void setCurrentPage(Integer currentPage) {
		this.currentPage = currentPage;
	}

	public void setCount(Integer count) {
		this.count = count;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public Integer getCurrentPage() {
		return currentPage;
	}

	public Integer getPriviousPage() {
		return priviousPage;
	}

	public void setPriviousPage(Integer priviousPage) {
		this.priviousPage = priviousPage;
	}

	public Integer getNextPage() {
		return nextPage;
	}

	public void setNextPage(Integer nextPage) {
		this.nextPage = nextPage;
	}

	public Integer getCount() {
		return count;
	}

	public Integer getPageCount() {
		return pageCount;
	}

	public void setPageCount(Integer pageCount) {
		this.pageCount = pageCount;
	}

	public List<T> getDataList() {
		return dataList;
	}

	public void setDataList(List<T> dataList) {
		this.dataList = dataList;
	}

	public Integer getStartIndex() {
		return startIndex;
	}

	public void setStartIndex(Integer startIndex) {
		this.startIndex = startIndex;
	}

	public Integer getEndIndex() {
		if (endIndex >= this.getCount()) {
			this.endIndex = this.getCount();
		}
		return endIndex;
	}

	public void setEndIndex(Integer endIndex) {
		this.endIndex = endIndex;
	}

}
